package maze;

public enum Direction {
	NORTH{
		public Direction left(){
			return WEST;
		}
		public Direction opposite(){
			return SOUTH;
		}
		public Direction right(){
			return EAST;
		}
	},
	SOUTH{
		public Direction left(){
			return EAST;
		}
		public Direction opposite(){
			return NORTH;
		}
		public Direction right(){
			return WEST;
		}
	},
	EAST{
		public Direction left(){
			return NORTH;
		}
		public Direction opposite(){
			return WEST;
		}
		public Direction right(){
			return SOUTH;
		}
	},
	WEST{
		public Direction left(){
			return SOUTH;
		}
		public Direction opposite(){
			return EAST;
		}
		public Direction right(){
			return NORTH;
		}
	};

	public abstract Direction left();
	public abstract Direction opposite();
	public abstract Direction right();
	
	public int PositiveAngleToDirection(Direction dir)
	{
		if(this == dir)
			return 0;
		else if(left() == dir)
			return 90;
		else if(right() == dir)
			return 270;
		else if(opposite()==dir)
			return 180;
			
		return 0;
	}
}
